package com.litong.rms.action;

import com.litong.rms.bean.User;
import com.litong.rms.service.UserService;
import com.litong.rms.util.AuthUtil;
import com.litong.rms.util.HttpUtil;

public class LoginAction extends BaseAction{

	/**
	 * 
	 */
	private UserService userService;
	
	private static final long serialVersionUID = 1L;
	
	private User user;
	
	public String execute(){
		//System.out.println(userService);
		user = userService.findUser(user);
		if(user!=null){
			HttpUtil.setSession("user", user);//将用户放入session
			AuthUtil.getModuleList(user);
			//AuthUtil.getFunctionList(AuthUtil.getModuleList(user).get(2));
			return SUCCESS;
		}
		HttpUtil.setSession("user", null);
		return INPUT;
		
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public User getUser() {
		return user;
	}

}
